<?php


$api = app('Dingo\Api\Routing\Router');
// 请求版本在header 里面;
$api->version('v1', [
    'namespace' => 'App\\Http\\Controllers',
    'middleware' => ['cross']
],function ($api) {
    $api->group([
        'prefix' => 'common',
        'namespace' => 'Common',
    ], function($api){
        //邮箱
        $api->get('email', 'EmailController@sendEmail');
        // 区域数据json
        $api->get('areajson', 'AreaController@getAreaJson');
        //查子集
        $api->get('childarea',"AreaController@getChildArea");
        // 查子集 id,text 格式
        $api->get('getchildformat',"AreaController@getChildformat");
        // 查询名称；
        $api->get('queryname', "AreaController@queryName");
    });

    $api->group([
        'prefix' => 'user',
        'namespace' => 'User',
    ],function($api){
        $api->group([
            'middleware' => ['auth'],
        ],function($api) {
            $api->get('info', "UserController@info"); #信息
            $api->get('updateinfo', "UserController@updateInfo"); #修改信息；
            $api->get('qrcode',  "UserController@getQrcode"); # 二维码
            $api->get('nearuser',  "UserController@getNearByDistance"); # 附近的人
            # 钱包
            $api->post('withdrawal', "WalletController@withdrawal"); # 钱包提现
            $api->post('walletrecord', "WalletController@walletRecord"); #钱包记录
            $api->post('walletincaserecord', "WalletController@walletIncaseRecord"); #钱包收入记录
            $api->post('walletdecaserecorc', "WalletController@walletDecaseRecorc"); #钱包减少记录
            $api->post('withdrawalapply', "WalletController@WithdrawalApply"); #提现单记录
            $api->get('multipesahreimg', 'UserController@getMultipleShareimg');  # 我得分享推广码
        });

        $api->post('miniprogram/login', "UserController@miniProgramLogin");  #登录
        $api->post('userlogin', "UserController@userLogin"); #账户登录
    });

    $api->group([
        'prefix' => 'file',
        'namespace' => 'File',
    ], function($api){

        $api->post('upload', 'UploadController@uploadFile');
        $api->get('getossaccess', 'UploadController@getOssToken')->middleware(['auth']);
        # 阿里云 原图读取；
        $api->get('getaliurlaccess', 'UploadController@getAliossUrlAccess');

    });

    # shop
    $api->group([
        'prefix' => 'shop',
        'namespace' => 'Shop',
    ], function($api){
        $api->get('goodslist', 'GoodsController@goodsList');
    });

    # house 房屋
    $api->group([
        'prefix' => 'house',
        'namespace' => 'House',
    ], function($api){
        $api->group([
            'middleware' => ['auth'],
        ], function($api){
            $api->post('deletefile', 'HouseController@deleteFile');
            $api->post('addfile', 'HouseController@addFile');
            $api->post('edit', 'HouseController@edit');
            $api->post('add', 'HouseController@addHouse');
            $api->post('addfllowup', 'HouseController@addFllowup');
            $api->get('info', 'HouseController@info');
        });
        $api->get('search', 'HouseController@search');

        $api->get('attr', 'HouseController@getHouseAttr');

    });


    # Dog 狗
    $api->group([
        'prefix' => 'dog',
        'namespace' => 'Dog',
    ], function($api){
        $api->post('userreg', 'RegController@userReg');
        $api->post('merreg', 'RegController@merReg');
    });

});


